package com.mezz.bones.framework.outbox.domain.entity;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;

import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 事务消息表
 * </p>
 *
 * @author mezz
 * @since 2025-04-29
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "outbox_message_dlq", autoResultMap = true)
@ApiModel(value="OutboxMessageDlq对象", description="事务消息表")
public class OutboxMessageDlq implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "自增主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "全局唯一消息ID(业务ID+时间戳)")
    private String messageId;

    @ApiModelProperty(value = "业务类型，如：order/create")
    private String businessType;

    @ApiModelProperty(value = "业务标识(如订单号)")
    private String businessKey;

    @ApiModelProperty(value = "消息内容(JSON格式)")
    private String content;

    @ApiModelProperty(value = "执行方式: HTTP/RPC/BEAN/MQ")
    private String executeType;

    @ApiModelProperty(value = "执行目标(URL/ServiceName/BeanName)")
    private String executeTarget;

    @ApiModelProperty(value = "方法名(RPC/BEAN方式使用)")
    private String executeMethod;

    @ApiModelProperty(value = "附加参数(JSON格式)")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private JSONObject executeParams;

    @ApiModelProperty(value = "0-待发送 1-已发送 2-已完成 3-失败 4-已取消")
    private Integer status;

    @ApiModelProperty(value = "已重试次数")
    private Integer retryCount;

    @ApiModelProperty(value = "最大重试次数")
    private Integer maxRetry;

    @ApiModelProperty(value = "下次重试时间")
    private Date nextRetryTime;

    @ApiModelProperty(value = "重试策略配置")
    private String executeRetryPolicy;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "业务事件发生时间")
    private Date eventTime;

    @ApiModelProperty(value = "首次执行时间")
    private Date firstExecuteTime;

    @ApiModelProperty(value = "最后执行时间")
    private Date lastExecuteTime;

    @ApiModelProperty(value = "完成时间")
    private Date completeTime;

    @ApiModelProperty(value = "最近一次执行结果")
    private String lastExecuteResult;

    @ApiModelProperty(value = "错误堆栈")
    private String errorStack;

    @ApiModelProperty(value = "扩展参数")
    private String extParams;

    @ApiModelProperty(value = "标签，逗号分隔")
    private String tags;

    @ApiModelProperty(value = "优先级(1-10)")
    private Integer priority;

    @ApiModelProperty(value = "版本号")
    private Integer version;

    @ApiModelProperty(value = "死信原因")
    private String deadReason;

    @ApiModelProperty(value = "1已删 0否")
    private Integer isDel;
}
